package com.mdp.core.utils;

import com.mdp.core.entity.LangTips;
import com.mdp.core.entity.Result;
import com.mdp.core.entity.Tips;
import com.mdp.core.err.BizException;
import com.mdp.core.err.QxException;

/**
 * 改由 Result 提供服务
 */
@Deprecated
public class ResponseHelper {


	public static Result failed(String tipscode, String msg, String moreMsg){
		 return Result.error(tipscode,msg).put("moreMsg",moreMsg);
	}

	public static Result failed(Tips tips){
		 return Result.error(LangTips.fromTips(tips));
	}
	
	public static Result failed(String tipscode,String msg){
		 return Result.error(tipscode,msg);
	}

	
	public static Result failed(BizException bizErr){
		 return Result.error(bizErr);
	}
	
	public static Result failed(QxException qxErr){
		 return Result.error(qxErr);
	}

	public static Result result(Tips tips){
		 return Result.build(LangTips.fromTips(tips));
	}

	public static Result ok(Tips tips){
		  return Result.build(LangTips.fromTips(tips));
	}

	public static Result ok(String msg){
		return ok(null,msg,null);
	}

	public static Result ok(String tipscode,String msg){
		return ok(tipscode,msg,null);
	}

	public static Result ok(String tipscode,String msg,Object data){
		 return Result.ok(tipscode,msg).setData(data);
	}
}
